mainApp.service('goodsService', ['$resource',function ($resource){
    
    //商品列表信息
    this.getGoogsList = function(pageIndex,pageSize,param,success,error){
        return $resource(baseUrl+"/mapi/mGoods/list/:pageIndex/:pageSize",{pageIndex:pageIndex,pageSize:pageSize}).save(param,success,error);
    };
    //上滑商品列表信息
    this.getGoogsListSH = function(startIndex,pageSize,param,success,error){
        return $resource(baseUrl+"/mapi/mGoods/listSH/:startIndex/:pageSize",{startIndex:startIndex,pageSize:pageSize}).save(param,success,error);
    };
    
    //商品详情信息
    this.getGoodsDetails = function(goodsId, success, error){
    	return $resource(baseUrl + "/mapi/mGoods/get/"+goodsId).get( success, error);
    };
    
    //商品评价
    this.getGoodsEvaluate = function(goodsId,pageIndex,pageSize,success, error) {
    	return $resource(baseUrl + "/mapi/mevaluate/getList/" + goodsId + "/"+pageIndex+"/"+pageSize).get(success, error);
    }
    //商品样式
     this.getGoodsStyleList = function(success, error) {
    	return $resource(baseUrl + "/dapi/mgStyle/getGStyleList").get(success, error);
    }
    //商品图片信息
     this.getGoodsPic = function(goodId,success,error) {
     	return $resource(baseUrl+"/mapi/mGoods/getAllPic/"+ goodId).get(success,error);
     } 
    //加入购物车
    this.addShopCart = function(param,success,error){
        return $resource(baseUrl+"/mapi/mshopingcart/add").save(param,success,error);
    };
    //查询购物车根据商品ID和用户
    this.getCartByUGId =function(goodsId,goodsweightId,success,error){
    	return $resource(baseUrl+"/mapi/mshopingcart/getCartByUGId/"+ goodsId+"/"+goodsweightId).get(success,error);
    }
    //查询首页轮播图片
    this.getAppPicList =function(success,error){
    	return $resource(baseUrl+"/mapi/appPic/getList").get(success,error);
    }
     //查询通知公告
    this.getNotic =function(success,error){
    	return $resource(baseUrl+"/mapi/mnotice/get").get(success,error);
    }
    //上滑商品初始化列表信息
    this.getGoogsListInit= function(pId,pageSize,param,success,error){
        return $resource(baseUrl+"/mapi/mGoods/listSH_init/:pId/:pageSize",{pId:pId,pageSize:pageSize}).save(param,success,error);
    };
    //获取三级列表菜单
    this.getGoogsTypeList = function(success,error){
        return $resource(baseUrl+"/dapi/mGoodType/getGoodNav").get(success,error);
    };
    //查询品型
    //查询购物车根据商品ID和用户
    this.getPxByPId =function(pId,success,error){
    	return $resource(baseUrl+"/dapi/mGoodType/getPxByPid/"+pId).get(success,error);
    }
}]);

